/*
 * This file Copyright (c) 2015. Walle.
 * (http://www.wallellen.com). All rights reserved.
 *
 *
 * This file is dual-licensed under both the
 * Walle Agreement (WA) and the GNU General Public License.
 * You may elect to use one or the other of these licenses.
 *
 * This file is distributed in the hope that it will be
 * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
 * Redistribution, except as permitted by whichever of the GPL
 * or WA you select, is prohibited.
 *
 * 1. For the GPL license (GPL), you can redistribute and/or
 * modify this file under the terms of the GNU General
 * Public License, Version 3, as published by the Free Software
 * Foundation.  You should have received a copy of the GNU
 * General Public License, Version 3 along with this program;
 * if not, write to the Free Software Foundation, Inc., 51
 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * 2. For the Walle Agreement (WA), this file
 * and the accompanying materials are made available under the
 * terms of the WA which accompanies this distribution, and
 * is available at http://www.wallellen.com/agreement.html
 *
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
 */

package com.wallellen.knowledge.know.service;

import com.wallellen.authority.domain.User;
import com.wallellen.core.auth.domain.LoginUser;
import com.wallellen.core.sql.query.DataQuery;
import com.wallellen.knowledge.doc.domain.ex.DocEntire;
import com.wallellen.knowledge.doc.exception.CanNoWriteException;
import com.wallellen.knowledge.doc.server.DocOperateRightInter;

/**
 * 知识管理
 *
 * @author <a href="mailto:wallellen@hotmail.com">WALLE</a>
 */
public interface KnowServiceInter {
    public static final String LUCENE_DIR = "KNOW";

    /**
     * 用户创建一条知识
     *
     * @param knowtitle     知识标题
     * @param knowtype      知识分类
     * @param text          知识内容
     * @param knowtag       知识标签
     * @param pop_type_edit 编辑权限
     * @param pop_type_read 阅读权限
     * @param groupId       小组id（可以为空）
     * @param currentUser   当前操作用户
     * @return 文档对象
     */
    public DocEntire creatKnow(String knowtitle, String knowtypeId, String text, String knowtag, DocOperateRightInter.POP_TYPE pop_type_edit,
                               DocOperateRightInter.POP_TYPE pop_type_read, String groupId, LoginUser currentUser);

    /**
     * 高级用户修改一条知识
     * /**
     *
     * @param id
     * @param knowtitle
     * @param knowtype
     * @param text
     * @param knowtag
     * @param pop_type_edit
     * @param pop_type_read
     * @param groupId
     * @param currentUser
     * @param editNote
     * @return
     * @throws CanNoWriteException
     */
    public DocEntire editKnow(String id, String knowtitle, String knowtype, String text, String knowtag,
                              DocOperateRightInter.POP_TYPE pop_type_edit, DocOperateRightInter.POP_TYPE pop_type_read, String groupId, LoginUser currentUser, String editNote)
            throws CanNoWriteException;

    /**
     * 普通用户修改知识标签和内容
     *
     * @param docid       知识主键
     * @param text        内容
     * @param knowtag
     * @param currentUser
     * @param editNote    修改备注
     * @return
     */
    public DocEntire editKnow(String docid, String text, String knowtag, LoginUser currentUser, String editNote)
            throws CanNoWriteException;


    /**
     * 由网页获得一条知识
     *
     * @param url
     * @return
     */
    public DocEntire getDocByWeb(String url, LoginUser user);

    /**
     * 展示当前用户的知识
     *
     * @param query
     * @return
     */
    public DataQuery getMyDocQuery(DataQuery dataQuery, User user);
}